tools: libxenstat: fix format string overflow
authorDario Faggioli <dfaggioli@suse.com>
Fri, 16 Feb 2018 18:38:48 +0000 (19:38 +0100)
committerWei Liu <wei.liu2@citrix.com>
Mon, 19 Feb 2018 17:04:43 +0000 (17:04 +0000)
commit8f9ccfe93570ecae18d9cc224931787d0bca9c66
tree7b4ff5261228a3083cd54bba64220114a2ea62aa
parentd3b230fc46ee9853064e167f6cb4da8ea0a08112
tools: libxenstat: fix format string overflow

With gcc 7.3.0, the build fails like this:

src/xenstat_linux.c: In function ‘getBridge’
src/xenstat_linux.c:78:34: warning: ‘%s’ directive writing up to 255 bytes into a region of size 241 [-Wformat-overflow=]
     sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
                                  ^~
src/xenstat_linux.c:78:5: note: ‘sprintf’ output between 23 and 278 bytes into a destination of size 256
     sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix by making the buffer bigger.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/xenstat/libxenstat/src/xenstat_linux.c